{extend name="base" /}
{block name="content"}
<div class="m-b-md">
    <h2 class="m-b-none">品牌列表</h2>
</div>
<div class="row">
    <div class="col-sm-12">
        <section class="panel panel-default">
            <div class="panel-body">
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th class="col-sm-1">品牌ID</th>
                        <th>品牌名称</th>
                        <th>排序</th>
                        <th class="col-sm-2">logo</th>
                        <th>是否热门</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <volist name="data" id="vo">
                        {foreach name="data" item="v"}
                        <tr>
                            <td>{$v['bid']}</td>
                            <td>{$v['bname']}</td>
                            <td>{$v['sort']}</td>
                            <td><img style="width: 30%" src="{$v['logo']}"></td>
                            <td>{$v['hot']== 1? '是':'否'}</td>
                            <td>
                                <div class="btn-group">
                                    <a href="{:url('admin/brand/add',['bid'=>$v['bid']])}" class="btn btn-info">编辑</a>
                                    <a href="javascript:;" onclick="del({$v['bid']})" class="btn btn-danger">删除</a>
                                </div>
                            </td>
                        </tr>
                        {/foreach}
                    </volist>
                    </tbody>
                </table>
            </div>
        </section>
    </div>
</div>
<div class="col-sm-12 text-right text-center-xs">
    <ul class="pagination pagination-sm m-t-none m-b-none">
    </ul>
</div>
<script>
    function del(bid) {
        var obj = util.modal({
            title:'确认删除吗?',//标题

            content:'',//内容

            footer:'<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button><button type="button" class="btn btn-danger confirm" data-dismiss="modal">删除</button>',//底部

            width:600,//宽度

            events:{
                confirm:function(){
                    //哪个元素上有.confirm类，被点击就执行这个回调
                    location.href = "{:url('del')}" + '?bid=' + bid;
                }
            }
        });
        //显示模态框
        obj.modal('show');
    }
</script>
{/block}